//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

#ifndef FLOWMULTIPLEXER_H_
#define FLOWMULTIPLEXER_H_

#include <omnetpp.h>
#include "BaseModule.h"
#include "BaseLayer.h"

class FlowMultiplexer : public BaseModule {
public:
    virtual ~FlowMultiplexer();

    void initialize(int stage);
    void handleMessage(cMessage *msg);

protected:
    virtual void handleLowerControl(cMessage* msg, int nicIndex);
    virtual void handleLowerMsg(cMessage *msg, int nicIndex);
    virtual void handleSelfMsg(cMessage* msg);
    virtual void handleUpperMsg(cMessage *mac, int appIndex);
    virtual void handleUpperControl(cMessage* msg, int appIndex);
    virtual void sendControlUp(cMessage *msg);
    virtual void sendDown(cMessage *msg);
    virtual void sendUp(cMessage *msg);

private:
    int lowLayerNumber;
    int upLayerNumber;

    int nicToUse;

    int *toUpLayer;
    int *fromUpLayer;
    int *toControlUpLayer;
    int *fromControlUpLayer;
    int *toDownLayer;
    int *fromDownLayer;
    int *toControlDownLayer;
    int *fromControlDownLayer;

};

#endif /* FLOWMULTIPLEXER_H_ */
